<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="./node_module"></script>
</head>
<body>
<button>发送请求</button>
<button>取消请求</button>
<script type="module">
    const btns= document.querySelectorAll('button');
    let btnCancel;
    btns[0].onclick= function(){
        btns[1].click();
        axios({
            url:'http://xuyihan.com/scoreList',
            cancelToken:new axios.CancelToken(cancel =>btnCancel=cancel)
        }).then(value=>{
            console.log(value.data);
        }).catch(err=>{
            console.log(err,axios.isCancel(err));
        })
    }
    btns[1].onclick= function(){
        if(btnCancel) btnCancel();
    }
</script>
</body>
</html>